<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>书城首页</title>
	<base href="http://localhost:8081/">
<link type="text/css" rel="stylesheet" href="static/css/style.css">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script language="JavaScript" type="text/javascript" src="static/js/index.js"></script>
</head>
<body>
	
	<div id="header">
			<img class="logo_img" alt="" src="static/img/logo.gif" >
			<span class="wel_word">网上书城</span>
			<div class="user">
                <c:choose>
                    <c:when test="${empty user}">
                        <a href="pages/user/login.jsp">登录</a> |
                        <a href="pages/user/register.jsp">注册</a> &nbsp;&nbsp;
                    </c:when>
                    <c:otherwise>
                    <div>
                        <span>欢迎<span class="um_span">${user.uname}</span>光临硅谷书城</span>
                    <c:choose>
                        <c:when test="${user.role ==0}">
				        <a href="cart.action?oper=getCartItemList">购物车</a>
                    </c:when>
                    <c:otherwise>
				        <a href="pages/manager/manager.html">后台管理</a>
                    </c:otherwise>
                    </c:choose>
                        <a href="order.action?oper=getOrderList">我的订单</a>
                        <a href="javascript:logout()">注销</a>&nbsp;&nbsp;
                        <a href="index.jsp">返回</a>
                    </div>
                    </c:otherwise>
                </c:choose>
			</div>
	</div>
	
	<div id="main">
		<div id="book">
			<div class="book_cond">
                <form action="login.action" method="post">
					<input type="hidden" name="oper" value="index">
				价格：<input type="text" name="minPrice">
					<span class="sp1">元</span> - 
					<input type="text" name="maxPrice">
					<span class="sp1">元</span>
					<input type="submit" value="查询"/>
                </form>
			</div>
			<div class="cont">
				<span>您的购物车中有3件商品</span>
					您刚刚将<span style="color: red">时间简史</span>加入到了购物车中
			</div>
            <c:forEach items="${bookList}" var="b">
			<div class="b_list">
				<div class="img_div">
					<img class="book_img" alt="" src="${b.bimg}" />
				</div>
				<div class="book_info">
					<div class="book_name">
						<span class="sp1">书名:</span>
						<span class="sp2">${b.bname}</span>
					</div>
					<div class="book_author">
						<span class="sp1">作者:</span>
						<span class="sp2">${b.author}</span>
					</div>
					<div class="book_price">
						<span class="sp1">价格:</span>
						<span class="sp2">${b.price}</span>
					</div>
					<div class="book_sales">
						<span class="sp1">销量:</span>
						<span class="sp2">${b.sales}</span>
					</div>
					<div class="book_amount">
						<span class="sp1">库存:</span>
						<span class="sp2">${b.bcount}</span>
					</div>
					<div class="book_add">
						<button onclick="addCart(${b.id})">加入购物车</button>
					</div>
				</div>
			</div>
            </c:forEach>
		<div id="page_nav">
                <input class="btn" type="button" value="首页" onclick="page(1,'${keyword}')" ${pageNo == 1 ? "disabled" : ""}/>
                <input class="btn" type="button" value="上一页"onclick="page(${pageNo-1},'${keyword}')" ${pageNo == 1 ? "disabled" : ""}/>
            <a href="#">3</a>
		【4】
		<a href="#">5</a>
            <input class="btn" type="button" value="下一页"onclick="page(${pageNo+1},'${keyword}')" ${pageNo == pageCount ? "disabled" : ""}/>
            <input class="btn" type="button" value="尾页" onclick="page(${pageCount},'${keyword}')" ${pageNo == pageCount ? "disabled" : ""} />
            共10页，30条记录 到第<input value="4" name="pn" id="pn_input"/>页
		<input type="button" value="确定">
		</div>
	
	</div>
	
	<div id="bottom">
		<span>
			尚硅谷书城.Copyright &copy;2015
		</span>
	</div>
    </div>
</body>
</html>